package cn.yunhe.pojo;

import lombok.Data;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

@Data
public class Orders {
    private String id;
    private String orderNum;
    private Date orderTime;
    private String orderTimeStr;
    private int orderStatus;
    private String orderStatusStr;
    private int peopleCount;
    private Product product;
    private List<Traveller> travellers;
    private Member member;
    private Integer payType;
    private String payTypeStr;
    private String orderDesc;

    public String getOrderTimeStr(){
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        return simpleDateFormat.format(orderTime);
    }

    public String getOrderStatusStr(){
        if(orderStatus == 0){
            orderStatusStr = "未支付";
        } else if(orderStatus == 1){
            orderStatusStr = "已支付";
        } else{
            orderStatusStr = "已取消";
        }
        return orderStatusStr;
    }

    public String getPayTypeStr(){
        if(payType == 0){
            payTypeStr = "微信";
        } else if(payType == 1){
            payTypeStr = "支付宝";
        } else {
            payTypeStr = "其他";
        }
        return payTypeStr;
    }
}